package utils

import (
	"gopkg.in/ini.v1"
)
var (
	AppMode string
	ServerIp  string
	HttpPort  string

	Db   string
	DbHost   string
	DbPort   string
	DbUsername  string
	DbPassword   string
	DbName   string

	AccessKey string
	SecretKey  string
	Bucket string
	QiniuServer  string
)
func init(){
	cfg,err := ini.Load("config/config.ini")
	if err!=nil {
		panic(err)
	}
	AppMode = cfg.Section("server").Key("AppMode").MustString("debug")
	ServerIp = cfg.Section("server").Key("ServerIp").MustString("127.0.0.1")
	HttpPort = cfg.Section("server").Key("HttpPort").MustString("8080")

	Db = cfg.Section("db").Key("Db").MustString("localhost")
	DbHost = cfg.Section("db").Key("DbHost").MustString("localhost")
	DbPort = cfg.Section("db").Key("DbPort").MustString("3306")
	DbUsername = cfg.Section("db").Key("DbUsername").MustString("root")
	DbPassword = cfg.Section("db").Key("DbPassword").String()
	DbName = cfg.Section("db").Key("DbName").String()

	AccessKey = cfg.Section("qiniu").Key("AccessKey").String()
	SecretKey = cfg.Section("qiniu").Key("SecretKey").String()
	Bucket = cfg.Section("qiniu").Key("Bucket").String()
	QiniuServer = cfg.Section("qiniu").Key("QiniuServer").String()
}
